package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.DeviceDto;
import com.zzyl.dto.DevicePageQueryDto;
import com.zzyl.entity.Device;
import com.zzyl.vo.DeviceDataVo;
import com.zzyl.vo.DeviceVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DeviceMapper {
    @Select("select count(1) from device where device_name=#{deviceName}")
    Long countByDeviceName(String deviceName);

    void addDevice(Device device);

    Page<DeviceVo> list(String deviceName, Integer locationType, String productKey);

    @Select("select * from device where iot_id=#{iotId}")
    DeviceVo seleteByIotId(String iotId);

    @Select("select count(*) from device where id=#{id}")
    Integer seleteById(Long id);

    void updateDevice(Device device);

    @Delete("delete from device where iot_id=#{iotId}")
    void deleteByIotId(String iotId);

    List<Long> selectNursingIdByIotIdWhereElder(String iotId);

    List<Long> selectNursingIdByIotIdWhereBed(String iotId);
}
